package com.twenty.seven.security.sign.controller;

import com.twenty.seven.common.ResultJson;
import com.twenty.seven.common.enums.StatusCode;
import com.twenty.seven.security.sign.entity.TripartiteCode;
import com.twenty.seven.security.sign.entity.TripartiteEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author 001
 * @Date 2020/1/16 15:16
 * @TODO
 **/
@RestController
@RequestMapping(value = "tp")
public class TripartitePlatformController {

    private Logger logger = LoggerFactory.getLogger(TripartitePlatformController.class);

    @PostMapping(value = "/test")
    public ResultJson test(@RequestBody TripartiteEntity tripartiteEntity){
        ResultJson resultJson = new ResultJson();
        logger.info("tripartiteEntity:::"+tripartiteEntity.toString());
        if (tripartiteEntity.getVerifyCode() == TripartiteCode.success.getCode()){
            resultJson.setCode(StatusCode.success.getCode());
            resultJson.setMessage(StatusCode.success.getName());
        }else{
            resultJson.setCode(StatusCode.fault.getCode());
            resultJson.setMessage(StatusCode.fault.getName());
        }
        return resultJson;
    }
}
